package servlet.newsType;

import dao.NewsTypeDao;
import entity.NewsType;
import util.GetParamToClass;
import util.R;
import util.ResposeUtil;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class DetailServlet extends HttpServlet {
    NewsTypeDao newsTypeDao = new NewsTypeDao();
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        NewsType newsType = (NewsType) GetParamToClass.setObjectFiled(req,NewsType.class);
        NewsType one = newsTypeDao.getOne(newsType.getId());
        ResposeUtil.write(new R(R.CODE_SUCCESS, one,R.MSG_SUCCESS) ,resp);
    }
}
